<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>debug</title>
	</head>
	<body>
		<div id="app">
			<p @click="showMenu">--{{isMenuVisible}}--</p>
		</div>

		<script src="https://unpkg.com/vue@3.4.17/dist/vue.global.prod.js"></script>
		<script>
			const { createApp, ref } = Vue;

			createApp({
				setup() {
					const isMenuVisible = ref(false);

					const showMenu = event => {
            isMenuVisible.value = !isMenuVisible.value;
            console.log('in showMenu')
            console.log(isMenuVisible)
					};

					const hideMenu = () => {
						isMenuVisible.value = false;
					};

					const handleMenuAction = action => {
						alert(`你选择了: ${action}`);
						hideMenu();
					};

					// // 隐藏菜单，当点击其他地方时
					// window.addEventListener('click', hideMenu);
					// window.addEventListener('contextmenu', hideMenu);

					return {
						isMenuVisible,
						showMenu,
					};
				},
			}).mount('#app');
		</script>
	</body>
</html>
